<!DOCTYPE html>
<html>
  <head>
    <title>活动信息详情</title>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">


    <link rel="stylesheet" href="__STATIC__/mobile/css/weui.min.css">
	<link rel="stylesheet" href="__STATIC__/mobile/css/jquery-weui.css">
    <!-- <link rel="stylesheet" href="css/style.min.css"> -->
    <link rel="stylesheet" href="__STATIC__/mobile/css/demos.css">
    <link rel="stylesheet" href="__STATIC__/mobile/css/main.css">
    <link rel="stylesheet" href="__STATIC__/mobile/css/iconfont.css">
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=DA6Bw0637vf4t96C4GRhyPBMyplqG6zA"></script>
    <style>
    	.navbar {
		    height: 50px;
		    color: #000;
		    background: #ffd966;
		    position: fixed;
		    top: 0;
		    left: 0;
		    right: 0;
		    z-index: 99;
		    display: -webkit-box;
		    display: -ms-flexbox;
		    overflow: hidden;
		}
		.navbar .nav-wrap-left {
		    height: 100%;
		    width: 25%;
		    line-height: 50px;
		}
		.navbar .nav-wrap-left .nav-btn {
		    padding-right: 0;
		}
		.navbar .nav-btn {
		    padding: 0 0 0 10%;
		   	width: 90%;
		   	height: 100%;
		    display: block;
		    color: #000;
		    font-size: 14px;
		}
		a:active, a:focus, a:hover, a:visited {
		    color: #bbb;
		}
		a, a:hover, del, ins, s, u {
		    text-decoration: none;
		}
		.barbtn, a, button, em, input, textarea {
		    -webkit-tap-highlight-color: rgba(255,0,0,0);
		}
		a {
		    color: #666;
		    text-decoration: none;
		    outline: 0;
		}
		.navbar .nav-title {
			width: 50%;
		    height: 100%;
		    overflow: hidden;
		    line-height: 50px;
		    text-align: center;
		    -webkit-box-flex: 1;
		    -ms-flex: 1;
		}
		.navbar .nav-wrap-right {
		    height: 100%;
		    width: 25%;
		    line-height: 50px;
		    text-align: right;
		}
		.filterbar .dropdown-toggle.active {
		    color: #179b16;
		}
		.icon-xuanzechengshi {
			font-size: 8px!important;
		}
		#joblist .list-item .salary span, #loadMore .list-item .salary span, #recommend-job .list-item .salary span {
		    color: #179b16;
		    font-size: .42rem;
		}
		.pic {
			width: 55px!important;
		}
		.pic img{
			width: 55px!important;
			height: 55px;
		}
		.filterbar .dropdown-wrapper {
		    position: absolute;
		    width: 100%;
		    z-index: inherit;
		}
		.filterbar .nav {
		    position: relative;
    		z-index: inherit;
		}
		.block {
			display: block;
		}
		.none {
			display: none;
		}
		.filterbar .nav {
		    display: -webkit-box;
		    display: -ms-flexbox;
		    background: #fff;
		    border-bottom: 1px solid #e5e5e5;
		    text-align: center;
		    height: .86rem;
		    line-height: .86rem;
		    -webkit-user-select: none;
		    font-size: 13px;
		    text-align: center;
		}
		.main {
			/*padding: 0!important;*/
			padding-top: 50px; 
			z-index: 9999999;
		}
		.filterbar .category-wrapper {
		    overflow: scroll;
		}
		.category-wrapper {
			max-height: 480px!important;
		}
		.  .top-logo img{
      border-radius: 50%;
    }
    /*.weui-uploader__file {
        width: 40%;
        height: 79px;
    }*/
    .top-logo {
        width: 100%;
        height: 8em;
        margin-top: 1em;
        overflow: hidden;
    }
    .top-logo img {
        width: 6em;
        height: 6em;
        margin: 1em auto;
        display: block;
    }
    .weui-cell2:after {
        content: " ";
        position: absolute;
        left: 0;
        right: 0;
        height: 1px;
        color: #d9d9d9;
        bottom: 0;
        border-bottom: 1px solid #d9d9d9;
        -webkit-transform-origin: 0 100%;
        transform-origin: 0 100%;
        -webkit-transform: scaleY(.5);
        transform: scaleY(.5);
    }
    /*.weui-uploader__file {
          float: left;
          background: no-repeat 50%;
          background-size: cover;
          display: inline-block;
          margin: 0px 5%;
          background-size: 100% 100%;
      }*/
    .weui-cells {
	    margin-top: 0.2em;
	}
    .weui-cell_select{
        padding:10px 15px;
    }
    </style>
  </head>

  <body ontouchstart style="background: #fff">
  	
    <div class="navbar">
        <div class="nav-wrap-left">
            <a class="nav-btn" href="javascript:history.go(-1);">
                <i style="font-size: 22px" class="iconfont icon-goback"></i>
            </a>
        </div>
		<div class="nav-title">活动信息详情</div>
        <div class="nav-wrap-right">
            
        </div>
    </div>
    <!-- 正文 -->
    <div class="main">
        <form action='' method='post'enctype="multipart/form-data" onsubmit='return checkInfo()'> 
        	<div class="weui-cells weui-cells_form">
    		    <div class="weui-cell">
    		        <div class="weui-cell__hd"><label class="weui-label">项目名称</label></div>
    		        <div class="weui-cell__bd">
    		            <input id="adacitvity_packname" name='aname' class="weui-input" type="text" placeholder="请输入项目名称">
    		        </div>
    		    </div>
    		    <div class="weui-cell weui-cell_select weui-cell_select-after">
    		        <div class="weui-cell__hd"><label class="weui-label">负责人</label></div>
    		        <div class="weui-cell__bd">
                    <select class="weui-input" name='principal' id="adacitvity_name">
                            <option></option>
                        <?php foreach($principal as $k=>$val):?>
                            <option>{$val}</option>
                        <?php endforeach;?>
                    </select>
                    <!--
    		            <input id="adacitvity_name" name='principal' class="weui-input" type="text" placeholder="请输入负责人">
                        -->
    		        </div>
    		    </div>
    		    <div class="weui-cell weui-cell_select weui-cell_select-after">
    		        <div class="weui-cell__hd"><label class="weui-label">城市</label></div>
    		        <div class="weui-cell__bd">
    		            <input id="adacitvity_city" name='city' class="weui-input" type="text" placeholder="请输入城市">
    		        </div>
    		    </div>
    		    <div class="weui-cell weui-cell_select weui-cell_select-after">
    		        <div class="weui-cell__hd"><label class="weui-label">楼盘</label></div>
    		        <div class="weui-cell__bd">
                        <select class="weui-input" name='loupan' id='loupan'>
                                <option></option>
                            <?php foreach($programName as $k=>$val):?>
                                <option>{$val['name']}</option>
                            <?php endforeach;?>
                        </select>
    		           
    		        </div>
    		    </div>
    		    <div class="weui-cell weui-cell_select  weui-cell_select-after">
    		        <div class="weui-cell__hd"><label class="weui-label">日期</label></div>
    		        <div class="weui-cell__bd">
    		            <input id="adacitvity_time" name='create_time' class="weui-input" type="text" placeholder="请输入日期" value="">
    		        </div>
    		    </div>
    		    <div class="weui-cell weui-cell_select weui-cell_select-after">
    		        <div class="weui-cell__hd"><label class="weui-label">督导</label></div>
    		        <div class="weui-cell__bd">
                    <select class="weui-input" name='dudao'  id="dudao">
                            <option></option>
                        <?php foreach($dudao as $k=>$val):?>
                            <option>{$val}</option>
                        <?php endforeach;?>
                    </select>
                    <!--
    		            <input id="adacitvity_supervisor" name='dudao' class="weui-input" type="text" placeholder="请输入督导">
                        -->
    		        </div>
    		    </div>
    		    <div class="weui-cell weui-cell_select weui-cell_select-after">
    		        <div class="weui-cell__hd"><label class="weui-label">促销生</label></div>
    		        <div class="weui-cell__bd">
                        <input class="weui-input" name='sales' id='sales'>
<!--                             <option></option>
                        <?php foreach($sales as $k=>$val):?>
                            <option>{$val['name']}</option>
                        <?php endforeach;?> -->
                        
    		            
    		        </div>
    		    </div>
    		    <div class="weui-cell  weui-cell_select weui-cell_select-after">
    		        <div class="weui-cell__hd"><label class="weui-label">运输人员</label></div>
    		        <div class="weui-cell__bd">
    		            <select class="weui-input" name='driver' id='driver'>
                            <option></option>
                            <?php foreach($drivers as $k=>$val):?>
                            <option>{$val['truename']}</option>
                            <?php endforeach;?>
                        </select>
    		        </div>
    		    </div>
    		    <div class="weui-cell weui-cell_select weui-cell_select-after">
    		        <div class="weui-cell__hd"><label class="weui-label">绩效数据</label></div>
    		        <div class="weui-cell__bd">
                        <select class="weui-input" name='jixiao' id='jixiao'>
                            <option></option>
                            <?php foreach($jixiao as $k=>$val):?>
                            <option>{$val['name']}</option>
                            <?php endforeach;?>
                        </select>
    		           
    		        </div>
    		    </div>

    		    <div class="weui-btn-area">
                <button type="submit" class="weui-btn weui-btn_primary">提交</button> 
    		    </div>
    	  	</div>	
        </form>
    </div>
   
	<div id="allmap1"></div>
    <script src="__STATIC__/mobile/js/jquery-2.1.4.js"></script>
    <!-- <script src="js/fastclick.js"></script> -->
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script>
  		$(function() { 
        $("#sales").select({
          title: "促销生",
          multi: true,
          items: ['暂无促销生']
        });       

        $("#adacitvity_time").calendar({
           onChange: function (picker, values, displayValues) {        
           },
           onClose : function(){
            var cityVal = $('#adacitvity_city').val().split(' ')
             getStudent(cityVal[1],$('#adacitvity_time').val())
           }
        });
        $("#adacitvity_city").cityPicker({
          title: "选择城市",
          showDistrict: false,
          onChange: function (picker, values, displayValues) {
            console.log(values, displayValues);
            // getStudent(displayValues[0] + displayValues[1],$('#adacitvity_time').val())      
          },
          onClose : function(){
            var cityVal = $('#adacitvity_city').val().split(' ')
             getStudent(cityVal[1],$('#adacitvity_time').val())       
          }
        });
  	});
    </script>
    <script src="__STATIC__/mobile/js/jquery-weui.js"></script>
    <script src="__STATIC__/mobile/js/city-picker.js"></script>
    <script src="__STATIC__/mobile/js/globalvariable.js"></script>
    <script src="__STATIC__/mobile/js/sose.js"></script>
  </body>
</html>
<script>
/*
     * 根据城市，时间挑选促销生
     * @param city {String}   活动添加时选择的城市
     * @param active_time {String}  活动添加选择的时间
     */
    function getStudent(city,active_time){
        let cityVal = city || '',
            activeTimeVal = active_time || '';
        $.ajax({
            url : 'http://house.wechatpic.com/Mobile/Interface/get_cuxiao',
            data : {
                city : cityVal,
                active_time : activeTimeVal
            },
            type : 'POST',
            dataType : 'json',
            success : function(data){
                /*
                 * @parem data {{JSON}}{Array} 如：[{ id: 0, text: 'enhancement' }, { id: 1, text: 'bug' }, { id: 2, text: 'duplicate' }, { id: 3, text: 'invalid' }, { id: 4, text: 'wontfix' }]
                 *
                 */
                if(data.msg == 0){
                    var str = [];
                    data.val.forEach(function(i){
                        str.push(i.text)
                    })
                    $("#sales").select('update',{
                      items : str
                    })                    
                    // $('#sales').html(str)
                }else{
                    $("#sales").select('update',{
                      items : ['暂无促销生']
                    })         
                }

            }
        })
    }

    function checkInfo(){
        var adacitvity_packname = $('#adacitvity_packname').val();
        if(adacitvity_packname == ''){
            alert('请输入项目名称');return false;
        }
        var adacitvity_name = $('#adacitvity_name').val();
        if(adacitvity_name == ''){
            alert('请选择项目负责人');return false;
        }
        var adacitvity_city = $('#adacitvity_city').val();
        if(adacitvity_city == ''){
            alert('请选择城市');return false;
        }
        var loupan = $('#loupan').val();
        if(loupan == ''){
            alert('请选择楼盘');return false;
        }
        var adacitvity_time = $('#adacitvity_time').val();
        if(adacitvity_time == ''){
            alert('请选择活动日期');return false;
        }
        var dudao = $('#dudao').val();
        if(dudao == ''){
            alert('请选择项目督导');return false;
        }
        var sales = $('#sales').val();
        if(sales == ''){
            alert('请选择项目促销生');return false;
        }
        var driver = $('#driver').val();
        if(driver == ''){
            alert('请选择项目运输人员');return false;
        }
        var jixiao = $('#jixiao').val();
        if(jixiao == ''){
            alert('请选择项目绩效');return false;
        }
        
        
    }
</script>
